]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dash: Use connectObject to track signal connection to global objects
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Wed, 15 Apr 2026 21:24:25 +0000 (23:24 +0200)
committerMarge Bot <marge-bot@gnome.org>
Fri, 17 Apr 2026 14:40:53 +0000 (14:40 +0000)
While the dash is never destroyed in vanilla gnome shell, various
extensions (such as dash-to-dock) are using this code, potentially for
every monitor.

And so we should make sure that the signals are disconnected when the
actor is destroyed.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4180>

js/ui/dash.js

index 1a0a841420eb08dcd776c538b6a016c00d93b34b..970bf9400d18b5cc795631eb93388807146e499e 100644 (file)
@@ -378,10 +378,13 @@ export const Dash = GObject.registerClass({
         this._workId = Main.initializeDeferredWork(this._box, this._redisplay.bind(this));
 
         this._appSystem = Shell.AppSystem.get_default();
+        this._appSystem.connectObject(
+            'installed-changed', () => this._queueRedisplay(),
+            'app-state-changed', () => this._queueRedisplay(),
+            this);
 
-        this._appSystem.connect('installed-changed', () => this._queueRedisplay());
-        AppFavorites.getAppFavorites().connect('changed', this._queueRedisplay.bind(this));
-        this._appSystem.connect('app-state-changed', this._queueRedisplay.bind(this));
+        AppFavorites.getAppFavorites().connectObject('changed',
+            () => this._queueRedisplay(), this);
 
         Main.overview.connectObject(
             'item-drag-begin', () => this._onItemDragBegin(),